The present invention relates generally to detecting changes to objects such as files of a computer system, and more particularly to a method and apparatus that detects changes to a collection of objects based upon a collection value for the collection of objects.
Computer systems commonly need to perform actions in response to changes to an object. Accordingly, computer systems need to determine whether changes to an object have occurred so that the computer system may take the appropriate actions. Prior art systems have typically determined whether an object has changed by determining whether a value associated with the object has changed. For example, computer systems typical include file systems that store files with an associated timestamp. Depending upon the file system, the timestamp may have different meanings (e.g. creation date, save date, modified date). While the timestamp may have different meanings under different file systems, the timestamp for a file will typically change when the file changes. Due to this relationship between the file and associated timestamp, prior art computer systems have typically tracked timestamps in order to determine whether the associated files have changed.
For example, in order to detect whether a file has changed, a prior art computer system stored a copy of the timestamp for the file and periodically compared the stored copy of the timestamp to the current timestamp for the file. While comparing timestamps (each typically containing a few bytes) consumes less storage and is simpler than directly comparing files (each possibly containing several megabytes), the above approach still consumes a large amount of storage when the computer system needs to detect changes to a large number of objects.
Therefore, what is needed is a method and apparatus that detect changes to objects in a manner that consumes less storage than storing an associated value such as a timestamp for each object.
In accordance with one embodiment of the present invention, there is provided a method of detecting a change to a collection of objects. One step of the method includes generating a first collection value that is based upon object values associated with the objects of the collection. Another step of the method includes storing the first collection value. The method also includes the step of generating a second collection value that is based upon the object values after the storing step. Moreover, the method includes the step of determining whether the collection has changed based upon the second collection value and the stored first collection value.
Pursuant to another embodiment of the present invention, there is provided a method of updating a first collection of first objects which are a copy of a second collection of second objects. One step of the method includes generating a first collection value that is based upon first object values associated with the first objects of the first collection. Another step of the method includes generating a second collection value that is based upon second object values associated with the second objects of the second collection. The method also includes the step of determining whether the first collection is different than the second collection based upon the first collection value and the second collection value. Moreover, the method includes the step of updating the first collection in response to the determining step determining that the first collection is different than the second collection.
Pursuant to yet another embodiment of the present invention, there is provided a computer readable medium that configures a processor to detect a change in a collection of objects. The computer readable medium includes a plurality of instructions. The plurality of instructions when executed by the processor cause the processor to generate a first collection value that is based upon object values associated with the objects of the collection. The plurality of instructions when executed by the processor also cause the processor to (i) store the first collection value, and (ii) generate after storing the first collection value a second collection value that is based upon the object values. Moreover, the plurality of instructions when executed by the processor cause the processor to determine whether the collection has changed based upon the second collection value and the stored first collection value.
It is an object of the present invention to provide a new and useful method and apparatus for detecting changes to objects.
It is another object of the present invention to provide an improved method and apparatus for detecting changes to objects.
It is an additional object of the present invention to provide a method and apparatus that detect changes to objects in a manner that consumes less storage than storing an associated value such as a timestamp for each object.
The above and other objects, features, and advantages of the present invention will become apparent from the following description and the attached drawings.